package com.training.mapper;



import com.training.dto.CommentDisplayDto; // 导入DTO

import com.training.entity.Comment;

import com.training.entity.CommentReply; // 导入新实体

import org.apache.ibatis.annotations.Mapper;

import org.apache.ibatis.annotations.Param;

import org.apache.ibatis.annotations.Options;

import java.util.List;



@Mapper

public interface CommentMapper {



// ... 原有方法保持不变 ...

    List<Comment> findCommentsByCourseId(@Param("courseId") Long courseId);

    Comment findCommentById(@Param("id") Long id);

    @Options(useGeneratedKeys = true, keyProperty = "id")

    int insertComment(Comment comment);

    int updateComment(Comment comment);

    int deleteComment(@Param("id") Long id);

    int countCommentsByCourseId(@Param("courseId") Long courseId);

    Double getAverageRatingByCourseId(@Param("courseId") Long courseId);



// --- 新增方法 ---

    List<CommentDisplayDto> findCommentsByTeacherId(@Param("teacherId") Long teacherId);

    int addReply(CommentReply reply);

}